using System;

using System.IO;

using System.Text;

using System.Collections;
using System.Collections.Generic;

using PickGold;
using PickGold.Database;
using DataCommon = PickGold.Database.Common;

namespace PickGold.Entities.Table
{
    public class CBaseFileInfo : CBaseTable
    {
        //
        public const string ENTITY_NAME = "tb_sys_file_info";
        public const string ENTITY_ALIAS = "files";
		public const string ENTITY_KEY = DataCommon.FILE_ID;
		public const string ENTITY_SYMBOL = DataCommon.FILE_NAME;
        //
        public const string ROLE_ID = CBaseRoleInfo.ENTITY_KEY;
        public const string USER_ID = CBaseUserInfo.ENTITY_KEY;
        public const string USER_WRITER = "user_writer";
        public const string PATH_ID = CBasePathInfo.ENTITY_KEY;
        public const string MIME_ID = CBaseMimeInfo.ENTITY_KEY;
		public const string ITEM_SIZE = DataCommon.ITEM_SIZE;
		public const string ITEM_CREATE = DataCommon.ITEM_CREATE;
		public const string ITEM_MODIFY = DataCommon.ITEM_MODIFY;
		public const string ITEM_REVIEW = DataCommon.ITEM_REVIEW;
        //
        private SBaseFileInfo _ = null;
        //
        public CBaseFileInfo() : base(ENTITY_NAME, ENTITY_ALIAS) { }
        public CBaseFileInfo(CDatabase db) : base(db, ENTITY_NAME, ENTITY_ALIAS) { }
        public CBaseFileInfo(string alias) : base(ENTITY_NAME, alias) { }
        public CBaseFileInfo(CDatabase db, string alias) : base(db, ENTITY_NAME, alias) { }
        //
        protected override void SetSchema()
        {
            this.SetSchema(new SBaseFileInfo());
        }
        protected void SetSchema(SBaseFileInfo s)
        {
            this._ = s;
            base.SetSchema(s);
        }
        //
        protected override void PreInitSchema()
        {
            base.PreInitSchema();
            this._DataTable.Columns.Add(ROLE_ID, typeof(long)).DefaultValue = this._.RoleID;
            this._DataTable.Columns.Add(USER_ID, typeof(long)).DefaultValue = this._.UserID;
            this._DataTable.Columns.Add(USER_WRITER, typeof(long)).DefaultValue = this._.UserWriter;
            this._DataTable.Columns.Add(PATH_ID, typeof(long)).DefaultValue = this._.PathID;
            this._DataTable.Columns.Add(MIME_ID, typeof(long)).DefaultValue = this._.MimeID;
            this._DataTable.Columns.Add(ITEM_SIZE, typeof(long)).DefaultValue = this._.ItemSize;
            this._DataTable.Columns.Add(ITEM_CREATE, typeof(DateTime)).DefaultValue = this._.ItemCreate;
            this._DataTable.Columns.Add(ITEM_MODIFY, typeof(DateTime)).DefaultValue = this._.ItemModify;
            this._DataTable.Columns.Add(ITEM_REVIEW, typeof(int)).DefaultValue = this._.ItemReview;
        }
        //
        #region Property
        //
		public long RoleID
        {
            set
            {
                this._.RoleID = value;
                this.SetValue(ROLE_ID, value);
            }
            get
            {
				return this._.RoleID;
            }
        }
        //
        public long UserID
        {
            set
            {
                this._.UserID = value;
                this.SetValue(USER_ID, value);
            }
            get
            {
                return this._.UserID;
            }
        }
        //
        public long UserWriter
        {
            set
            {
                this._.UserWriter = value;
                this.SetValue(USER_WRITER, value);
            }
            get
            {
                return this._.UserWriter;
            }
        }
        //
        public long PathID
        {
            set
            {
                this._.PathID = value;
                this.SetValue(PATH_ID, value);
            }
            get
            {
                return this._.PathID;
            }
        }
        //
        public long MimeID
        {
            set
            {
                this._.MimeID = value;
                this.SetValue(MIME_ID, value);
            }
            get
            {
                return this._.MimeID;
            }
        }
        //
        public long ItemSize
        {
            set
            {
                this._.ItemSize = value;
                this.SetValue(ITEM_SIZE, value);
            }
            get
            {
                return this._.ItemSize;
            }
        }
        //
        public DateTime ItemCreate
        {
            set
            {
                this._.ItemCreate = value;
                this.SetValue(ITEM_CREATE, value);
            }
            get
            {
                return this._.ItemCreate;
            }
        }
        //
        public DateTime ItemModify
        {
            set
            {
                this._.ItemModify = value;
                this.SetValue(ITEM_MODIFY, value);
            }
            get
            {
                return this._.ItemModify;
            }
        }
        //
        public int ItemReview
        {
            set
            {
                this._.ItemReview = value;
                this.SetValue(ITEM_REVIEW, value);
            }
            get
            {
                return this._.ItemReview;
            }
        }
        //
        #endregion
        //
		public override bool MoveTo(int position)
		{
			if (!base.MoveTo(position))
				return false;

			this._.RoleID = this.GetValue<long>(ROLE_ID, true);
			this._.UserID = this.GetValue<long>(USER_ID, true);
			this._.UserWriter = this.GetValue<long>(USER_WRITER, true);
			this._.PathID = this.GetValue<long>(PATH_ID, true);
			this._.MimeID = this.GetValue<long>(MIME_ID, true);
			this._.ItemSize = this.GetValue<long>(ITEM_SIZE, true);
			this._.ItemCreate = this.GetValue<DateTime>(ITEM_CREATE, true);
			this._.ItemModify = this.GetValue<DateTime>(ITEM_MODIFY, true);
			this._.ItemReview = this.GetValue<int>(ITEM_REVIEW, true);
			return true;
		}
        //
    }
    //
    public class SBaseFileInfo : SBaseTable
    {
        //
        public long RoleID = -1;
        public long UserID = -1;
        public long UserWriter = -1;
        public long PathID = -1;
        public long MimeID = -1;
        public long ItemSize = 0;
        public DateTime ItemCreate = DateTime.MinValue;
        public DateTime ItemModify = DateTime.MinValue;
        public int ItemReview = 0;
        //
    }
    //
}
//
